package com.ruoyi.system.domain;

import java.math.BigDecimal;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.http.HttpHelper;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;

/**
 * 热费计算模板对象 sys_heat_fee_template
 *
 * @author ruoyi
 * @date 2024-08-20
 */
@Data
public class SysHeatFeeTemplate extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 热费模板id */
    private Long templateId;

    /** 热费模板名称 */
    @Excel(name = "热费模板名称")
    private String templateName;

    /** 部门id */
    @Excel(name = "部门id")
    private Long deptId;

    /** 计算公式 */
    @Excel(name = "计算公式")
    private String expressionFirst;

    /** 二挡公式 */
    @Excel(name = "二挡公式")
    private String expressionSecond;

    /** 三挡公式 */
    @Excel(name = "三挡公式")
    private String expressionThird;

    private String firstTarget;

    private String secondTarget;

    private Integer targetType;


    public String getFirstTarget() {
        String result = firstTarget;
        if (result == null){
            return result;
        }


        return ServletUtils.urlDecode(result);
    }

    public String getSecondTarget() {
        String result1 = secondTarget;
        if (result1 == null){
            return result1;
        }
        return ServletUtils.urlDecode(result1);
    }
    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
                .append("templateId", getTemplateId())
                .append("templateName", getTemplateName())
                .append("deptId", getDeptId())
                .append("createTime", getCreateTime())
                .append("createBy", getCreateBy())
                .append("updateTime", getUpdateTime())
                .append("updateBy", getUpdateBy())
                .append("remark", getRemark())
                .append("expressionFirst", getExpressionFirst())
                .append("expressionSecond", getExpressionSecond())
                .append("expressionThird", getExpressionThird())
                .append("firstTarget", getFirstTarget())
                .append("secondTarget", getSecondTarget())
                .toString();
    }

    private String regexReplace(final Pattern regex_pattern, final String replacement, final String s)
    {
        Matcher m = regex_pattern.matcher(s);
        return m.replaceAll(replacement);
    }
}
